import {  getAction } from '@/api/manage';
export const StudengFiles = {
  data(){
    return {
      searchData: {
        semesterId: '',
        classId: '',
        studentId: '',
        stuName:"",
        semesterName:""
      },
      dataList:[],
    }
  },
  mounted() {
    this.load();
  },
  methods:{
    // 加载报表
    load() {
      const dataForm = this.dataForm
      // 查询列表数据
      this.searchData.semesterId = dataForm.semesterId ? dataForm.semesterId : dataForm.semesterHistoryId
      this.searchData.classId = dataForm.classId ? dataForm.classId : undefined
      this.searchData.studentId = dataForm.studentId ? dataForm.studentId : undefined
      this.searchData.startDate = dataForm.startDate;
      this.searchData.endDate = dataForm.endDate;
      this.searchData.stuName = dataForm.stuName;
      this.searchData.semesterName = dataForm.semester.semesterName;
      this.initStudentChart();
    },
    queryData(data = {}){
      return new Promise((resolve, reject) => {
        let  params = {
          semesterId:this.searchData.semesterId,
          startDate: this.searchData.startDate,
          endDate: this.searchData.endDate,
          studentId:this.searchData.studentId
        }
        params = Object.assign(params,data);
        getAction(this.url.query,params).then((res)=>{
          if(res.success){
            resolve(res.result)
          } else {
            this.$message.warning(res.message);
          }
        }).catch((error)=>{
          console.error(error);
        })
      })
    },
  }

}